﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Printing;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem
{
    /// <summary>
    /// PreviewPrintWindow.xaml 的交互逻辑
    /// </summary>
    public partial class PreviewPrintWindow : BaseToolWindow
    {

        #region Variables

        private PrintTemplate _printContent;

        private static PreviewPrintWindow _instance;

        private Viewbox _vb;

        #endregion

        #region Constructor

        public PreviewPrintWindow()
        {
            InitializeComponent();
            _vb = new Viewbox();
        }

        #endregion

        #region Properties

        public PrintTemplate PrintContent
        {
            set
            {
                _printContent = value;
                PrintTemplate.PrintVisul = value;
                _gridPrint.Children.Clear();
                _gridPrint.Children.Add(value);
            }
        }

        public static PreviewPrintWindow Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new PreviewPrintWindow();
                }
                return _instance;
            }
        }

        #endregion

        #region 依赖属性

        #endregion

        #region Event

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods


        #endregion

        #region EventHandlers
        private void _btnPrint_Click(object sender, RoutedEventArgs e)
        {
            if (_printContent is PrintTemplate)
            {
                _printContent.Print();
            }
        }

        #endregion


    }
}
